#include <iostream>
#include <vector>
#include <map>

using namespace std;

class Solution
{
public:
    int majorityElement(vector<int> &nums)
    {
        map<int, int> count;
        int maxValue = 0;
        int maxCount = 0;
        for (int num : nums)
        {
            count[num]++;
            if (count[num] > maxCount)
            {
                maxCount = count[num];
                maxValue = num;
            }
        }
        return maxValue;
    }
};

int main()
{
    cout << "Code169" << endl;
    Solution s;
    std::vector<int> nums{3, 2, 2};
    cout << s.majorityElement(nums) << endl;
    return 0;
}